<?php 
session_start(); 
include('cgi/system/connect.php'); 
$my_id = $_SESSION['my_id'];
if (empty($my_id)) {                                    
    header('Location: http://alika-love-agency.com/en/registration.html');
}  
$sql = "SELECT          
        chat2_chanels.girl_src,
        sf_guard_user.id,
        sf_guard_user.nickname,
        sf_guard_user.first_name,
        sf_guard_user.username,
        sf_guard_user.account,
        sf_guard_user.photo,
        sf_guard_user.phone,
        sf_guard_user.gender
        FROM
        sf_guard_user
        Left Join chat2_chanels ON chat2_chanels.user_id = sf_guard_user.id 
        WHERE
        sf_guard_user.id = '$my_id'";
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result)) {
    $my_info = $row;
}                             
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
   
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
      <meta http-equiv="imagetoolbar" content="no" />
      <title>
         Alika Love Agency :: Live chat
      </title>
      <script type="text/javascript" src="js/jquery-1.3.2.min.js">
      </script>             
      <script type="text/javascript">
        jQuery.noConflict();
      </script>
      <script type="text/javascript" src="js/tables.js">
      </script>
      <script type="text/javascript" src="js/backgrund_but.js">
      </script>
      <script type="text/javascript" src="js/buttons.js">
      </script>                                             
      <script type="text/javascript" src="js/swfobject.js"></script> 
      <script src="js/prototype.js" type="text/javascript"></script>
      <script src="js/scriptaculous/scriptaculous.js" type="text/javascript"></script>
      <script src="js/nice_alert.js" type="text/javascript"></script>
      <link type="text/css" rel="stylesheet" href="css/style.css" />
      <!--[if IE 6]>
         <script src="js/DD_belatedPNG_0.0.7a-min.js">
         </script>
         <script>
            DD_belatedPNG.fix('.png, img');
         </script>
      <![endif]-->
   </head>   

<script language="javascript" type="text/javascript"> 
<!--
var current_user;
current_user = 0;
current_room = 0;
var my_id = <?php echo($_SESSION['my_id']);?>;
var my_name = '<?php                                                       
if ((!empty($my_info['first_name'])) && (strlen($my_info['first_name']) >= 3)) {
    echo $my_info['first_name'];      
} elseif (!empty($row['nickname'])) {
    echo $my_info['nickname'];        
} else {
    echo $my_info['username'];
}
?>';
var my_gender = '<?=$my_info['gender']?>';  
var users = {};
var video = 0;
var video_chanels = {};
function ctrl_enter(e, form)
{
    if (((e.keyCode == 13) || (e.keyCode == 10))) { send_message(); return false; }
}  
<?php if($my_info['gender'] == 'w'){ ?>    
function toggle_video() {      
    if (video == 0) {     
        new Ajax.Request('cgi/use_chanel.php', {
          onComplete: function(transport) { 
            if (transport.responseText == '0') {
                alert('Нет свободных каналов. Попробуйте позже.')
            } else {
                $('video_player_holder').show();
                $('no_video').hide();   
                turnOnVideo(transport.responseText);  
                video = 1;                  
            }
          }
        });  
    } else {
        new Ajax.Request('cgi/del_chanel.php', {
          onSuccess: function(transport) {                 
            $('video_player').innerHTML = '';  
            $('video_player_holder').hide();
            $('no_video').show(); 
            video = 0;                 
          }
        }); 
    }  
}
function turnOnVideo(i) {
    var s1 = new SWFObject('swf/chanels/'+i+'.swf',"single","230px","140px","10");
  //  var s1 = new SWFObject('swf/girl.swf',"single","230px","140px","10");
    s1.addParam("wmode","transparent");
    s1.write("video_player");
}
<?php } else { ?>
function toggle_video() {          
    if ((typeof(video_chanels[current_user]) != 'undefined' ) && (video_chanels[current_user].video != '0')) {  
        new Ajax.Request('cgi/close_chanel.php?uid='+current_user+'&rid='+current_room, {
          onComplete: function(transport) {               
                turnOffVideo(current_user);
          }
        });
    } else {             
        new Ajax.Request('cgi/open_chanel.php?uid='+current_user+'&rid='+current_room, {
          onComplete: function(transport) {
            if (transport.responseText == '0') {
               alert('User camera is off'); 
            }  else if (transport.responseText == 'e') {
               alert('Not enough credits on your account'); 
               alert('<a target="_blank" href="http://alika-love-agency.com/en/account_index.html">Buy credits</a>');
            }  else {                  
                $('video_player_holder').show();
                $('no_video').hide();                                                                              
                //turnOnVideo(transport.responseText);    
                
               /* $('video_on').hide();
                $('video_off').show();  
                $('user_player').show();                                                       
                $('no_user_player').hide();  */                                                     
                turnOnVideo('u'+transport.responseText);                    
                video_chanels[current_user].video = 'u'+transport.responseText;     
                $$('#u'+current_user+' .chat_webcam_icon')[0].show();
            }              
          }
        });            
    }
} 
function turnOnVideo(i) {                          
    var s1 = new SWFObject('swf/chanels/'+i+'.swf',"single","230px","140px","10"); 
 //   var s1 = new SWFObject('swf/user.swf',"single","150px","120px","10");
    s1.addParam("wmode","transparent");
    s1.write("video_player");
}    
function turnOffVideo(i) {                      
    $('video_player').innerHTML = '';  
    $('video_player_holder').hide();
    $('no_video').show();  
    /*               
    $('user_player').innerHTML = '';  
    $('video_on').show(); 
    $('video_off').hide();
    $('user_player').hide();                                                       
    $('no_user_player').show();  */
    video_chanels[i].video = '0';              
    $$('#u'+i+' .chat_webcam_icon')[0].hide();
}       
<?php } ?>

function send_message() {
    if ($('text_message').value != '') {
        new Ajax.Request('cgi/send.php', {
          parameters: {room_id:$('input_room_id').value,text:''+$('text_message').value+''},
          onSuccess: function(response) {
          }
        });
        $('messages_'+current_user).insert({
          top: insert_new_mess(my_gender,my_name,$('text_message').value) 
        });
        if ($('u'+current_user).getAttribute('status') == 1) {  
            $('u'+current_user).getElementsByTagName("img")[0].src='images/chat_inline_write.png';
        } else {
            $('u'+current_user).getElementsByTagName("img")[0].src='images/chat_offline_write.png';
        }
        $('text_message').value = '';              
    }
    return false;
} 
function insert_new_mess(who,name,text) {
var d = new Date();
 
var curr_hour = d.getHours();
var curr_min = d.getMinutes();
var curr_sec = d.getSeconds();    
if (curr_sec.toString().length == 1) {
    curr_sec  = '0'+curr_sec.toString();
}
var now = (curr_hour + ":" + curr_min + ":" + curr_sec);
 
    if (who == 'w') {
        text = '<div class="chat_mass_girl">\
                    <span class="chat_mass_time">'+now+'</span>\
                    '+name+': '+text+'\
                </div>'
    } else {   
        text = '<div class="chat_mass_man">\
                    <span class="chat_mass_time">'+now+'</span>\
                    '+name+': '+text+'\
                </div>'
    } 
    text = '<li>'+text+'</li>';
    return text;
}
function clear_selected_user() {
    $$('.user_options ul li').each(function(el){      
        el.removeClassName('selected');
    });
    $$('.messages').each(function(el){
        el.hide();
    });
    $$('.cur').each(function(el){
        el.removeClassName('cur');
    });
}            
function change_user(el) {
    current_user = el.getAttribute('tid');
    if (el.getAttribute('rid')) {
        current_room = el.getAttribute('rid');
    }
    clear_selected_user();
    $('messages_'+el.getAttribute('tid')).show();  
    //jQuery('.chat_online_scroll').animate({height:h_mans+55})
    //jQuery('#messages_'+el.getAttribute('tid')).animate({height:h_mans-54})                                                    
       
    if ($('messages_'+el.getAttribute('tid')).getAttribute('closed') == 1) {
        $('text_message').setAttribute('disabled','disabled');
    } else {
        $('text_message').removeAttribute('disabled');
    }    
   /* console.log(users[''+current_user+''].ava);                                     
    if (users[''+current_user+''].ava == '') {
       users[''+current_user+''].ava = 'http://alika-love-agency.com/images/no_avatar_man.jpg';     
    } else {
       users[''+current_user+''].ava = 'http://alika-love-agency.com/uploads/users/avatar/thumbnail/'+users[''+current_user+''].ava;
    }  */
    $('chat_id_list').innerHTML = '<a target="_blank" href="/en/show_profile.html?id='+users[''+current_user+''].id+'"><img src="'+users[''+current_user+''].ava+'" alt="" width="80" class="chat_online_img" /></a>'+
                                        '<div class="chat_online_descr" id="chat_online_descr">'+
                                        '<strong><a target="_blank" href="/en/show_profile.html?id='+users[''+current_user+''].id+'">'+users[''+current_user+''].name+'</a> <img src="images/aoutside.gif" /></strong><br />id: '+users[''+current_user+''].id+'<br />'+users[''+current_user].info+
                                      /*  '</strong>, Холостой мужчина, '+users[''+current_user].eye_color+' глаза и '+users[''+current_user].hair_color+' волосы'+  */
                                        '</div>'+
                                        '<div class="clear" style="font:11px/1.2em Tahoma, Geneva, sans-serif;">'+
                                            '<a class="textcenter" style="display:inline-block; padding:12px 0 0 0; background:url(images/mail_ico.gif) center 3px no-repeat; width:80px;" target="_blank" href="/en/mail_reply.html?id='+users[''+current_user+''].id+'"><strong><?php if($my_info['gender']=='m') {echo ('Send<br />message'); }else {echo('Написать<br />письмо');} ?></strong> <img src="images/aoutside.gif" /></a>'+
                                            '<a class="textright" style="width:130px; display:inline-block;" onclick="return del_from_chat(this);" tid="'+el.getAttribute('tid')+'" rid="'+el.getAttribute('rid')+'" href="#"><?php if($my_info['gender']=='m') {echo ('Remove'); }else {echo('Удалить');} ?></a>'+
                                        '</div>'; 
    $('u'+el.getAttribute('tid')).addClassName('selected');     
    $('u'+el.getAttribute('tid')).removeClassName('new_mess');      
    $('u'+el.getAttribute('tid')).addClassName('cur'); 
    if (el.getAttribute('rid')) { 
        $('input_room_id').value = el.getAttribute('rid');    
    }
    var h_id_list = jQuery('.chat_id_list').height()
    var h_mans = h_id_list + 230     
    $('messages_'+el.getAttribute('tid')).style.height = (h_mans-54)+'px';
    $('user_list').style.height = (h_mans+55)+'px';
    $('text_message').focus();                             
    <?php if($my_info['gender'] == 'm'){ ?> 
    if(typeof(video_chanels[parseInt(el.getAttribute('tid'))]) === 'undefined') {             
        /*$('user_player').innerHTML = '';   
        $('video_on').show(); 
        $('video_off').hide();
        $('user_player').hide();                                                       
        $('no_user_player').show();*/ 
        $('video_player').innerHTML = '';  
        $('video_player_holder').hide();
        $('no_video').show();    
    } else {
        if (video_chanels[parseInt(el.getAttribute('tid'))].video != '0') { 
            /*$('video_on').hide();
            $('video_off').show();  
            $('user_player').show();                                                       
            $('no_user_player').hide(); */
            $('video_player_holder').show();
            $('no_video').hide();        
            turnOnVideo(video_chanels[el.getAttribute('tid')].video);
        } else {           
            /*$('user_player').innerHTML = '';   
            $('video_on').show(); 
            $('video_off').hide();
            $('user_player').hide();                                                       
            $('no_user_player').show();   */
            $('video_player').innerHTML = '';  
            $('video_player_holder').hide();
            $('no_video').show();                                          
        }  
    }
    <?php } ?>                         
   // return false;
}
function add_to_chat(el) {
    if ($('u'+el.getAttribute('tid')) != null) {
        change_user($('u'+el.getAttribute('tid')));
       // alert('You already talking with him');
        return false;
    }                      
    new Ajax.Request('cgi/add.php?uid='+el.getAttribute('tid'), {
      onSuccess: function(transport) { 
        var user = {};
        user.id = el.getAttribute('tid');
        user.name = el.getAttribute('tname');
        user.rid = transport.responseText;
        current_user = user.id;         
        $('input_room_id').value = transport.responseText;  
        new_room(user);           
        clear_selected_user();   
        current_room = transport.responseText;                                                     
        $('messages_'+user.id).show();         
        var h_id_list = jQuery('.chat_id_list').height()
        var h_mans = h_id_list + 230     
        $('messages_'+user.id).style.height = (h_mans-54)+'px';
        $('u'+user.id).addClassName('selected');     
        change_user(el);        
      }
    });
    return false;
}
function del_from_chat(el) {
    var idrem = el.getAttribute('tid');        
    //el = $('u'+idrem).nextSibling;      
    $('messages_'+idrem).remove();     
    $('u'+idrem).remove();     
    new Ajax.Request('cgi/delete.php?uid='+idrem+'&rid='+el.getAttribute('rid'));
    var childCount = $('chat_with').getElementsByTagName('a').length;      
    $('chat_id_list').innerHTML = '';
    if (childCount == 0) {
        clear_selected_user();   
        return false;                        
    }
    el = $('chat_with').childNodes[0];    
    current_user = el.getAttribute('tid');
    clear_selected_user();           
    change_user(el);
   // $('u'+el.getAttribute('tid')).addClassName('selected');
  //  $('messages_'+el.getAttribute('tid')).show();  
    return false;
}
function runIt() {
      jQuery(".new_mess").wait()
              .animate({"opacity": 0.7},200)
              .wait()
              .animate({"opacity": 1},300,runIt);
}  
function star_new_message(id) {
    $('u'+id).addClassName('new_mess');              
    runIt();
}
function update_online(data) {
    var tt = '';
    $('online_count').innerHTML = data.length;
    for(var i = 0;i < data.length;i++) {
        users[data[i].id] = data[i];          
        var dop = '';
        if (data[i].video == 1) {
            dop = '<img src="images/chat_webcam_icon.png" alt="this user have video">';
        } 
        /*
        <strong>'+data[i].age+' лет</strong>, '+gender+', '+data[i].eye_color+' глаза и '+data[i].hair_color+' волосы\
        */
              
        
        if ((data[i].ava == '') || (data[i].ava == null)) {
           data[i].ava = 'http://alika-love-agency.com/images/no_avatar_man.jpg';     
        } else {
           data[i].ava = 'http://alika-love-agency.com/uploads/users/avatar/thumbnail/'+data[i].ava;
        }                           
        tt += '<div class="chat_online_item">\
                        <a tid="'+data[i].id+'" tname="'+data[i].name+'" onclick="add_to_chat(this)" href="#"><img src="'+data[i].ava+'" alt="" width="80" class="chat_online_img" /></a>\
                        <div class="chat_online_descr">\
                            <strong><a tid="'+data[i].id+'" tname="'+data[i].name+'" onclick="add_to_chat(this)" href="#">'+data[i].name+'</a></strong><br />id: '+data[i].id+'<br />\
                            '+data[i].info+'\
                            '+dop+'\
                      </div>\
              </div>';
     /*   tt += '<li>\
            <img src="/img/man.jpg" />\
            <span>'+data[i].name+'</span><br />\
            <a tid="'+data[i].id+'" tname="'+data[i].name+'" onclick="add_to_chat(this)" href="#">Chat with</a>\
        </li>';  */               
    } 
    $('user_list').innerHTML = tt;
}
function update_mes(data) {
    for(var i = 0;i < data.length;i++) { 
        if (data[i].messages != '') {              
            for(var k = 0;k < data[i].messages.length;k++) {                                         
                var tt = insert_new_mess(data[i].messages[k].gender,data[i].messages[k].name,data[i].messages[k].text);
                $('messages_'+data[i].contact.id).insert({
                  top: tt 
                });
                if (current_user != data[i].contact.id) {
                    star_new_message(data[i].contact.id);         
             //       alert('New message from '+data[i].contact.name);
                }
            }
        }
    }                                           
}
function new_room(reciver) { 
    if ($('u'+reciver.id) != null) {                
        return;
    }     
    //console.log(reciver);
    ///uploads/users/avatar/thumbnail/7e8ed944f9cd6e680cecb54922a2421428619e76.jpg
    $('chat_txt_box').insert({
          top: '<div style="display:none" id="messages_'+reciver.id+'" class="chat_box messages">\
                Start conversation with <b>'+reciver.name+'</b>\
                </div>'
    });
    $('chat_with').insert({
          top: '<a href="#" id="u'+reciver.id+'" onclick="change_user(this);return false;"  tid="'+reciver.id+'" rid="'+reciver.rid+'" class="chat_list_id_bg">\
            <img src="images/chat_online.png" alt="" class="status_icons" />\
          <strong>'+reciver.name+'</strong> (ID: '+reciver.id+')\
          <img src="images/chat_webcam_icon2.png" style="display: none;" alt="" class="chat_webcam_icon" />\
          <img src="images/chat_webcam_icon.png" style="display: none;" alt="" class="chat_have_webcam_icon" />\
          </a>'
    });   
}
function disable_chat(id) {
    $('u'+id).remove();
    $('messages_'+id).remove();
    var childCount = $('chat_with').getElementsByTagName('a').length;      
    $('chat_id_list').innerHTML = '';
    if (childCount == 0) {
        clear_selected_user();   
        return false;                        
    }
    el = $('chat_with').childNodes[0];    
    current_user = el.getAttribute('tid');
    clear_selected_user();           
    change_user(el);
   /* 
    if ($('messages_'+id).getAttribute('closed') != 1) {
        $('messages_'+id).insert({
          top: '<li style="color:red">Oponent closed chat</li>' 
        });             
        $('messages_'+id).setAttribute('closed',1);
    }   */                                       
}

function clearing_chatlist(data) {    
    var childs = $('chat_with').getElementsByTagName('a'); 
    var reciver;     
    if (data.length == 0) {
        current_user = 0;
        $('chat_id_list').innerHTML = '';
        $$('.messages').each(function(el){
            el.remove();
        });
        $('chat_with').innerHTML = '';
        return false;
    }
    for(var i = 0;i < childs.length;i++) {             
        for(var j = 0;j < data.length;j++) {               
            for(var k = 0;k < data[j].users.length;k++) {                                                         
                if (data[j].users[k].id != my_id) {
                    reciver = data[j].users[k].id;
                }  
            }   
            if (childs[i].getAttribute('tid') != reciver) {
                if (childs[i].getAttribute('tid') == current_user) {
                   current_user = 0; 
                }
                childs[i].remove();
            }   
        }           
    }  
   /* if ($('u'+current_user) == null) {         
        var user = $('chat_with').childNodes[0];
        current_user = user.getAttribute('tid'); 
    }*/
 //   return current_user;
}

function update_room(data) { 
   // video_chanels = {};   
   //console.log(data.length);                         
    for(var i = 0;i < data.length;i++) {  
        var reciver_id;                           
        var reciver_data;                                                  
        
                                 
        for(var k = 0;k < data[i].users.length;k++) {                                                         
            if (data[i].users[k].id != my_id) {
                reciver = data[i].users[k];
                reciver.rid = data[i].id;
            }  
        }               
       // console.log(reciver);
        new_room(reciver);          
                                     
        var video_icon = $$('#u'+reciver.id+' .chat_webcam_icon');  
        if (data[i].with_video != '0') {                     
            video_icon[0].show();                
        } else {                     
            video_icon[0].hide();                
            if ((typeof(video_chanels[reciver.id]) != 'undefined' ) && (video_chanels[reciver.id].video != '0')) {
                turnOffVideo(reciver.id); 
                alert('Your money account is empty.');
                alert('<a target="_blank" href="http://alika-love-agency.com/en/account_index.html">Buy credits</a>');
            }             
        }                   
      //  if (data[i].with_video != '0') {
           // video_icon.show();
        //} else {   
           // video_icon.hide();
           /* if (video_chanels[''+reciver.id].video != '0') {
                turnOffVideo(current_user);
            } */
       // }            
                                                                                                
        video_chanels[reciver.id] = {'video':data[i].with_video};                                                          
        for(var k = 0;k < data[i].users.length;k++) {     
            if (data[i].users[k].id != my_id) {
                if (data[i].users[k].status == 0) {           
                   if ($('u'+data[i].users[k].id).getAttribute('status') != 0) {                  
                    $('u'+data[i].users[k].id).getElementsByTagName("img")[0].src = 'images/chat_offline.png';
                    $('u'+data[i].users[k].id).setAttribute('status','0');
                   }                                  
                   // $('u'+data[i].users[k].id).removeClassName('online');
                   // $('u'+data[i].users[k].id).addClassName('offline');    
                } else {                  
                    if ($('u'+data[i].users[k].id)) {  
                        if ($('u'+data[i].users[k].id).getAttribute('status') != 1) {  
                            $('u'+data[i].users[k].id).getElementsByTagName("img")[0].src = 'images/chat_online.png';
                            $('u'+data[i].users[k].id).setAttribute('status','1');                            
                        }
                    }
                }                                                                     
                <?php if($my_info['gender'] == 'm'){ ?> 
                var video_icon = $$('#u'+data[i].users[k].id+' .chat_have_webcam_icon');
                if (data[i].users[k].have_video != '0') {                   
                    video_icon[0].show();
                }  else {
                    if (video_icon[0]) {
                        video_icon[0].hide();
                    }
                } 
                <?php } ?> 
            }
        }                     
                            
                                                 
          
        if (data[i].status != '1') {
           disable_chat(reciver.id); 
        }
        if (data[i].messages != '') {               
            if ($('u'+reciver.id).getAttribute('status') == 1) {  
                $('u'+reciver.id).getElementsByTagName("img")[0].src='images/chat_inline_write.png';
            } else {
                $('u'+reciver.id).getElementsByTagName("img")[0].src='images/chat_offline_write.png';
            }                             
           for(var k = 0;k < data[i].messages.length;k++) {                
                var tt = insert_new_mess(data[i].messages[k].gender,data[i].messages[k].name,data[i].messages[k].text);
                //var tt = insert_new_mess('he',data[i].messages[k]);                                    ;
                $('messages_'+reciver.id).insert({
                  top: tt 
                });
                Sound.play( 'sndIncMsg.wav', {replace:true});   
                if (current_user != reciver.id) {
                    star_new_message(reciver.id);  
                   // Sound.play( '/sndIncMsg.wav', {replace:true});            
                }   
            }
        }
                            
                        
    }   
                                         
                                    
    var childCount = $('chat_with').getElementsByTagName('a').length; 
    if (data.length != childCount) {
       clearing_chatlist(data);
     //   $('chat_with').innerHTML = ''; 
      // current_user = 0;
    }             
    if (current_user == 0) {
        var user = $('chat_with').childNodes[0]; 
        change_user(user);     
        return false;
    }   
}

      
function init() {  
    $('messages_9999').innerHTML = '';
    $('messages_9999').hide();
    var pupd = new Ajax.PeriodicalUpdater('test', 'cgi/ajax.php', {
        'decay':1,
        'frequency':5,        
        onLoading: function() {
            $('statuc_updater').innerHTML = 'Live Chat <img style="margin:3px 0 0 15px;float:right" src="images/updater.gif" />'
        },  
        onSuccess: function(transport) { 
           // console.log(transport);  
            var Jdata = transport.responseJSON;  
            if (Jdata == 'go away!') {
                window.location="http://alika-love-agency.com/en/account_index.html";
            } else {    
               //console.log(Jdata.online);                       
                if ( Jdata == null ) {
                    $('statuc_updater').innerHTML = 'Live Chat (updating failed, waiting for reconnect...)';
                } else {                     
                    $('statuc_updater').innerHTML = 'Live Chat';
                }                                           
                update_online(Jdata.online);
                update_room(Jdata.chating);  
                $('text_message').focus(); 
                <?php if($my_info['gender'] == 'm') { ?>   
                $('mymoney').innerHTML = Jdata.money;
                <?php }?>
            }
           // update_mes(Jdata.user_chat);
        }
    });             
}
//-->
</script>
   
<body onload="init()">
<div style="width:980px; margin:0 auto; position:relative;">
    <div style="height:135px; background:url(images/chat_header.jpg) 0 0 no-repeat;">
      	<div class="chat_menu_top" style="position:absolute; top:82px; left:300px">
            <a target="_blank" href="/en/my_profile.html"><?php if($my_info['gender']=='m') {echo ('My profile'); }else {echo('Мой профайл');} ?></a>
            <a target="_blank" href="/en/mailbox_input.html"><?php if($my_info['gender']=='m') {echo ('My messages'); }else {echo('Мои сообщения');} ?></a>
            <a target="_blank" href="/search/advform"><?php if($my_info['gender']=='m') {echo ('Find girls'); }else {echo('Поиск мужчин');} ?></a>
        </div>
        <div style="font:700 14px/1.2em Tahoma, Geneva, sans-serif; color:#fff; position:absolute; top:111px; left:40px"><?php if($my_info['gender']=='m') {echo ('Online'); }else {echo('Онлайн');} ?> (<span id="online_count">0</span>)</div>
        <div style="font:700 14px/1.2em Tahoma, Geneva, sans-serif; color:#fff; position:absolute; top:111px; left:272px" id="statuc_updater">Live Chat</div>
        <div class="chat_video_bg">
            <div id="video_player_holder" style="display:none;margin:3px 0 0 0">
               <div id="video_player">
               </div>
               <a style="margin:4px 0 0 66px" onclick="return toggle_video()" class="but_style but_otstup_1" href="#"><?php if($my_info['gender']=='m') {echo ('Disconect'); }else {echo('Отключить');} ?></a>  
            </div>
        	<div id="no_video" class="chat_video_otstup">
            	<div class="chat_iam">
                	<img src="http://alika-love-agency.com<?php 
                    if ( (empty($my_info['photo'])) || ($my_info['photo'] == 'null') ) {
                        echo('/images/no_avatar_man.jpg');
                    } else {
                        echo('/uploads/users/avatar/thumbnail/'.$my_info['photo']);
                    }                     
                    ?>" alt="" width="59" class="chat_iam_avatar" />
                	<div class="chat_iam_id"><?=$my_info['nickname']?><br /><?=$my_info['id']?>
                     <?php if($my_info['gender']=='m') { ?><br /><br />Credits:<br /><span id="mymoney"><?=$my_info['account']?></span> <?php } ?>
                    </div>
                </div><!-- .chat_iam-->
                <div class="chat_video_block" id="user_player" style="display:none">
                </div>
                <div class="chat_video_block" id="no_user_player">
                	<span class="chat_video_border"><img width="153" src="images/no_video.jpg" alt="" /></span>   
                </div><!-- .chat_video_block-->
                <a id="video_on" onclick="return toggle_video()" class="but_style but_otstup_1" href="#"><?php if($my_info['gender']=='m') {echo ('Connect'); }else {echo('Включить');} ?></a>
                <a id="video_off" style="display:none" onclick="return toggle_video()" class="but_style but_otstup_1" href="#"><?php if($my_info['gender']=='m') {echo ('Disconnect'); }else {echo('Выключить');} ?></a>
            </div><!-- .chat_video_otstup-->
        </div><!-- .chat_video_bg-->
    </div>
    <div style="overflow:hidden; padding:7px 0 0 0">
    	<div class="chat_left_coll">
        	<div class="chat_online_mans">
				<div class="chat_online_scroll" id="user_list">                                
                </div><!-- .chat_online_scroll-->
            </div><!-- .chat_online_mans-->
        </div><!-- .chat_left_coll-->
        <div style="float:left; clear:right; width:490px; overflow:hidden">
        	<div class="chat_txt_box" id="chat_txt_box">
                <div class="messages" id="messages_9999">
                    <span class="welcome">
                       <center>
                       <?php if($my_info['gender']=='m') {echo ('Chat initializing...'); }else {echo('Чат инициализируется...');} ?>                      <br /><img src="images/animation_processing.gif" height="150px" />
                       </center>
                    </span>
                </div>    
            </div><!-- .chat_txt_box-->
            <form action="#" onsubmit="return send_message()">
            <input type="hidden" name="room_id" value="0" id="input_room_id"/>            
            <div style="background:#fff;border:1px solid #d70101;padding:10px 0 10px 10px;margin:0 0 7px 0;    //zoom:1">
                <div style="width:478px;overflow:hidden;">       
              <textarea id="text_message" onkeypress="return ctrl_enter(event, this.form);"  name="message" style="overflow:auto; position:relative; height:68px; //height:66px;  border:0; font:12px/1.2em Tahoma, Geneva, sans-serif; color:#333; //zoom:1; display:block; width:478px; //width:475px;"></textarea>
                  </div>
            </div>
                <input class="but_style" type="submit" value=" <?php if($my_info['gender']=='m') {echo ('Send message'); }else {echo(' Отослать сообщение');} ?>" /> <?php if($my_info['gender']=='m') {echo ('or Enter'); }else {echo('либо Enter');} ?>
              <div style="font:11px/1.2em Tahoma, Geneva, sans-serif;padding:5px 0 0 0">
              <?php if($my_info['gender']=='m') {echo ('Warning! Exchange contact information is prohibited.'); }else {echo(' Внимание! Обмен контактной информацией запрещен');} ?>                                                        
                </div>    
            </form>
        </div>
        <div class="chat_right_coll">
       	  <div class="chat_list_id">
            
      		<div class="chat_id_list" id="chat_id_list">
            
			</div><!-- .chat_id_list-->
          
              <div class="chat_list_id_block" id="chat_with">    
              </div><!-- .chat_list_id_block-->
              
          </div>
        </div>
    </div>
	
</div> 
<script language="javascript" type="text/javascript"> 
var h_id_list = jQuery('.chat_id_list').height();
var h_mans = h_id_list + 230;
$('messages_9999').style.height = (h_mans-54)+'px';
$('user_list').style.height = (h_mans+55)+'px';       
$('text_message').focus(); 
</script> 

<?php if (!empty($my_info['girl_src'])) { ?>   
<script language="javascript" type="text/javascript"> 
toggle_video(); 
</script>
<?php } ?>   
</body>
</html>